classdef SynapseDendrite < handle
    
    properties (Dependent = true, SetAccess = private)
        % calculated private properties
    end
        
    properties (SetAccess = private, GetAccess = public)
        Neuron
        IncreaseStrengthFactor
        DecreaseStrengthFactor
    end
    
    properties (SetAccess = public, GetAccess = public)
        Strength
    end
    
    methods
        
        function SD = SynapseDendrite(neuron, increaseStrengthFactor, decreaseStrengthFactor)
            SD.Neuron = neuron;
            SD.IncreaseStrengthFactor = increaseStrengthFactor;
            SD.DecreaseStrengthFactor = decreaseStrengthFactor;
        end
        
        function Fire(obj, value)
            fired = obj.Neuron.IncreaseCharge(value);
            
            if fired == true
                obj.Strength = obj.Strength * (1 + obj.IncreaseStrengthFactor);
            else
                obj.Strength = obj.Strength * obj.DecreaseStrengthFactor;
            end
            
        end
        
    end
    
end

